package com.czxy.mapper;

import com.czxy.pojo.Sku;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @author  张青卯
 */
@org.apache.ibatis.annotations.Mapper
public interface SkuMapper extends Mapper<Sku> {

    /**
     * findSellCountBySkuId
     * @param skuId SKUID
     * @return Integer
     */
    @Select("SELECT count(*) FROM tb_order s,tb_order_good t WHERE t.sku_id = #{skuId} AND t.sn = s.sn AND s.`status` >= 4")
    Integer findSellCountBySkuId(Integer skuId);

    @Select("select * from tb_sku where spu_id = #{spuId}")
    List<Sku> findSkuListBySpuId(Integer spuId);


}